home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Unix / go4gw_1.01 / g2snmp < prev    next >
Encoding:
Text File  |  1992-10-08  |  15.8 KB  |  555 lines

  1. #!/usr/local/bin/perl
  2. ###################################################
  3. #
  4. # Standard RCS Header information (see co(1))
  5. #
  6. # $Author: schemers $
  7. #
  8. # $Date: 1992/10/08 21:48:02 $
  9. #
  10. # $Revision: 1.1 $
  11. #
  12. # $Locker: schemers $
  13. #
  14. # $Source: /networking/src/gopher/gateways/g2snmp,v $
  15. #
  16. # $State: Exp $
  17. #
  18. # $Log: g2snmp,v $
  19. # Revision 1.1  1992/10/08  21:48:02  schemers
  20. # Initial revision
  21. #
  22. #--------------------------------------------------
  23. # Copyright (c) 1992 Board of Trustees
  24. #            Leland Stanford Jr. University
  25. ###################################################
  26. # /*
  27. #  * Redistribution and use in source and binary forms are permitted
  28. #  * provided that the above copyright notice and this paragraph are
  29. #  * duplicated in all such forms and that any documentation,
  30. #  * advertising materials, and other materials related to such
  31. #  * distribution and use acknowledge that the software was developed
  32. #  * by Stanford University.  The name of the University may not be used 
  33. #  * to endorse or promote products derived from this software without 
  34. #  * specific prior written permission.
  35. #  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  36. #  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  37. #  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  38. #  */
  39. #----------------------------------------------------------------------
  40. # variables you should change:
  41.  
  42. $snmp_table = "/usr/local/bin/snmp-table";
  43.  
  44. #----------------------------------------------------------------------
  45.  
  46.  
  47. sub snmp_main {
  48.  local($_) = @_;
  49.  
  50.  if (/^$/) {
  51.     &Greply("7SNMP Agent\t$Ggw menu\t$Ghost\t$Gport");
  52.     &Greply(".");
  53.     exit(0);
  54.  }
  55.  
  56. if (/^menu\s+(.*)/i)         {  &do_menu($1);  } 
  57. elsif (/^at\s+(.*)/i)        {  &dump_at($1); }
  58. elsif (/^system\s+(.*)/i)    {  &dump_system($1); }
  59. elsif (/^interface\s+(.*)/i) {  &dump_interface($1); }
  60. elsif (/^ip\s+(.*)/i) {  &dump_ip($1); }
  61. elsif (/^icmp\s+(.*)/i) {  &dump_icmp($1); }
  62. elsif (/^tcp\s+(.*)/i) {  &dump_tcp($1); }
  63. elsif (/^udp\s+(.*)/i) {  &dump_udp($1); }
  64. else {
  65.   &Gabort("Unknown command!");
  66.   exit;
  67. }
  68.  
  69. }
  70.  
  71. sub do_menu {
  72.     local($agent)=@_;
  73.     &Greply("0Address Translation Group\t$Ggw at $agent\t$Ghost\t$Gport");
  74.     &Greply("0Interface Group\t$Ggw interface $agent\t$Ghost\t$Gport");
  75.     &Greply("0ICMP Group\t$Ggw icmp $agent\t$Ghost\t$Gport");
  76.     &Greply("0IP Group\t$Ggw ip $agent\t$Ghost\t$Gport");
  77.     &Greply("0System Group\t$Ggw system $agent\t$Ghost\t$Gport");
  78.     &Greply("0TCP Group\t$Ggw tcp $agent\t$Ghost\t$Gport");
  79.     &Greply("0UDP Group\t$Ggw udp $agent\t$Ghost\t$Gport");
  80.     &Greply(".");
  81.     exit(0);
  82. }
  83.  
  84.  
  85. chop($date=`date`);
  86.  
  87. %ifType2a = (
  88.         1, 'other',
  89.         2, 'regular1822',
  90.     3, 'hdh1822',
  91.     4, 'ddn-x25',
  92.     5, 'rfc877-x25',
  93.     6, 'ethernet-csmacd',
  94.     7, 'iso88023-csmacd',
  95.     8, 'iso88024-tokenBus',
  96.     9, 'iso88025-tokenRing',
  97.     10,' iso88026-man',
  98.     11,' starLan',
  99.     12,' proteon-10Mbit',
  100.     13,' proteon-80Mbit',
  101.     14,' hyperchannel',
  102.     15,' fddi',
  103.     16,' lapb',
  104.     17,' sdlc',
  105.     18,' ds1',
  106.     19,' e1',
  107.     20,' basicISDN',
  108.     21,' primaryISDN',
  109.     22,' propPointToPointSerial',
  110.     23,' ppp',
  111.     24,'softwareLoopback',
  112.     25,' eon,',
  113.     26,' ethernet-3Mbit',
  114.     27,' nsip',
  115.     28,' slip',
  116.     29,' ultra',
  117.     30,' ds3',
  118.     31,' sip',
  119.     32,' frame-relay'
  120. );
  121.  
  122. %ifAdminStatus2a = (1,'up',2,'down',3,'testing');
  123. %ifOperStatus2a = %ifAdminStatus2a ;
  124.  
  125. %ifRouteType2a=(1,'other',2,'invalid',3,'direct',4,'remote');
  126.  
  127. %ipNetToMediaType2a=(1,'other',2,'invalid',3,'dynamic',4,'static');
  128.  
  129. %tcpConnState2a=(1,'closed',2,'listen',3,'synSent',4,'synReceived',
  130.           5,'established',6,'finWait1',7,'finWait2',8,'closeWait',
  131.           9,'lastAck',10,'closing',11,'timeWait');
  132.  
  133. %ipForwarding2a=(1,'gateway',2,'host');
  134.  
  135. %tcpRtoAlgorithm2a = (1,'other',2,'constant',3,'rsre',4,'vanj');
  136.  
  137. sub sysServices2a {
  138.   local($x) = @_;
  139.   local($result);
  140.  
  141.   $result .= "physical, " if ($x & 1);
  142.   $result .= "data-link, " if ($x & 2);
  143.   $result .= "internet, " if ($x & 4);   
  144.   $result .= "end-to-end, " if ($x & 8); 
  145.   $result .= "application, " if ($x & 64);
  146.  
  147.   $result =~ s/, $//;
  148.   return $result;
  149. }
  150.  
  151. sub timeTicks2a {
  152.   local($ticks)= @_;
  153.   local($d,$h,$m,$s,$result);
  154.   
  155.   $ticks /= 100;
  156.  
  157.   $d = int($ticks / (60 * 60 * 24));
  158.   $ticks %= (60*60*24);
  159.  
  160.   $h = int($ticks / (60 * 60));
  161.   $ticks %= (60*60);
  162.  
  163.   $m = int($ticks/60);
  164.   $s = $ticks % 60;
  165.  
  166.   $result = sprintf("%d:%02d:%02d",$h,$m,$s);
  167.   if ($d==1) {
  168.         $result = sprintf("%d day ",$d) . $result;
  169.   } elsif ($d>1) {
  170.         $result = sprintf("%d days ",$d) . $result;
  171.   }
  172.   return $result;
  173.  
  174. }
  175.  
  176. sub hexString2a {
  177.    local($string) = @_;
  178.    local($result,$n);
  179.      
  180.    foreach (split(/:/,$string)) {
  181.        $n = oct("0x$_");
  182.        last if !$n;
  183.        $result .= sprintf("%c",$n);
  184.    }
  185.    $result;
  186. }
  187.  
  188. sub dump_system {
  189.  
  190.   local($host) = @_;
  191.   local(*int);
  192.  
  193.   &get_table($host,"system",*int);
  194.  
  195.     print "\n";
  196.     print "Host: $host\nDate: $date\n";
  197.     print "\n";
  198.     print " "*30,"System Table\n";
  199.     print "System Description\n  ", $int{"sysDescr[0]"},"\n\n";
  200.     print "UpTime       ", &timeTicks2a($int{"sysUpTime[0]"}),"\n";
  201.     print "ObjectID     ", $int{"sysObjectID[0]"},"\n";
  202.     $sysName =  $int{"sysName[0]"};
  203.     $sysContact = $int{"sysContact[0]"};
  204.     $sysLocation = $int{"sysLocation[0]"};
  205.     $sysServices = $int{"sysServices[0]"};
  206.     if ($sysName || $sysContact || $sysLocation || $sysServices) {
  207.     print "Name         $sysName\n";
  208.     print "Contact      $sysContact\n";
  209.     print "Location     $sysLocation\n";
  210.     print "Services     ",&sysServices2a($sysServices),"\n";
  211.     }
  212.     print "\n";
  213. }
  214.  
  215. sub dump_interface {
  216.   local($host) = @_;
  217.   local(*int);
  218.  
  219.   &get_table($host,"interfaces",*int);
  220.  
  221.   $number = $int{"ifNumber[0]"};
  222.     print "\n";
  223.     print "Host: $host\nDate: $date\n";
  224.     print "\n";
  225.     print " "*30,"Interface Table\n";
  226.     print "\n";
  227.  
  228.     print "Number of interfaces = $number\n";
  229.  
  230.   for ($i=1; $i <= $number; $i++) {
  231.     print "\n";
  232.    print "-"*40,"Interface $i\n";
  233.     $ifIndex = $int{"ifIndex[$i]"};
  234.     $ifDescr = &hexString2a($int{"ifDescr[$i]"});
  235.     $ifType  = $ifType2a{$int{"ifType[$i]"}};
  236.     $ifMtu   = $int{"ifMtu[$i]"};
  237.     $ifSpeed = $int{"ifSpeed[$i]"};
  238.     $ifPhysAddress = $int{"ifPhysAddress[$i]"};
  239.     $ifAdminStatus = $ifAdminStatus2a{$int{"ifAdminStatus[$i]"}};
  240.     $ifOperStatus  = $ifOperStatus2a{$int{"ifOperStatus[$i]"}};
  241.     $ifLastChange  = &timeTicks2a($int{"ifLastChange[$i]"});
  242.     $ifInOctets = $int{"ifInOctets[$i]"}+0;
  243.     $ifInUcastPkts = $int{"ifInUcastPkts[$i]"}+0;
  244.     $ifInNUcastPkts = $int{"ifInNUcastPkts[$i]"}+0;
  245.     $ifInDiscards =  $int{"ifInDiscards[$i]"}+0;
  246.     $ifInErrors = $int{"ifInErrors[$i]"}+0;
  247.     $ifInUnknownProtos = $int{"ifInUnknownProtos[$i]"}+0;
  248.     $ifOutOctets = $int{"ifOutOctets[$i]"}+0;
  249.     $ifOutUcastPkts = $int{"ifOutUcastPkts[$i]"}+0;
  250.     $ifOutNUcastPkts =$int{"ifOutNUcastPkts[$i]"}+0;
  251.     $ifOutDiscards = $int{"ifOutDiscards[$i]"}+0;
  252.     $ifOutErrors = $int{"ifOutErrors[$i]"}+0;
  253.     $ifOutQlen =  $int{"ifOutQlen[$i]"}+0;
  254. print "\n";
  255. if ($ifDescr) {  
  256. printf("Description     %s (%d)\n",$ifDescr,$ifIndex); 
  257. }
  258. else          {  
  259. printf("Description     (%d)\n",$ifIndex); 
  260. }
  261. printf("Address         $ifPhysAddress\n");
  262. printf("Type            %s\n",$ifType);
  263. printf("Mtu             %s\n",$ifMtu);
  264. printf("Speed           %s (%s)\n",$ifSpeed,int($ifSpeed/1000000)." MBS");
  265. printf("Status          %s",$ifOperStatus);
  266. if ($ifAdminStatus ne $ifOperStatus) { 
  267.       printf("(desired state: $ifAdminStatus)"); 
  268.  
  269. }
  270. if ($int{"ifLastChange[$i]"}) { print "(last config change: $ifLastChange)";}
  271. printf("\n");
  272. printf("Unknwn Proto    %s\n",$ifInUnknownProtos);
  273. printf("Output Q len    %s\n",$ifOutQlen);
  274.  
  275.  
  276. printf("Input\n");
  277. printf("  Octects       %d\n",$ifInOctects);
  278. printf("  unicast       %d\n",$ifInUcastPkts);
  279. printf("  broad/multi   %d\n",$ifInNUcastPkts);
  280. printf("  discards      %d\n",$ifInDiscards);
  281. printf("  errors        %d\n",$ifInErrors);
  282. printf("Output\n");
  283. printf("  Octects       %d\n",$ifOutOctets);
  284. printf("  unicast       %d\n",$ifOutUcastPkts);
  285. printf("  broad/multi   %d\n",$ifOutNUcastPkts);
  286. printf("  discards      %d\n",$ifOutDiscards);
  287. printf("  errors        %d\n",$ifOutErrors);
  288.  
  289.  
  290.   }
  291. }
  292.  
  293. sub dump_at {
  294.  
  295.   local($host) = @_;
  296.   local(*at);
  297.  
  298.   &get_table($host,"at",*at);
  299.  
  300.     print "\n";
  301.     print "Host: $host\nDate: $date\n";
  302.     print "\n";
  303.     print "       Address Translation Group\n";
  304.     print "\n";
  305.  
  306.     printf("%8s %17s       %s\n","Interface","Physical Addr","IP Addr");
  307.  
  308.   foreach (keys %at) {
  309.  
  310.       if (/^atIfIndex\[([^]]*)/) {
  311.          $_ = $index = $1;
  312.          ($if,$ip) = /(\d+)\.\d+\.(.*)/;
  313.          printf("   %2d       %s    %s\n",$if,$at{"atPhysAddress[$index]"},$ip);
  314.       }
  315.   }
  316.     print "\n";
  317. }
  318.  
  319.  
  320. sub dump_ip {
  321.  
  322.   local($host) = @_;
  323.   local(*ip);
  324.  
  325.   &get_table($host,"ip",*ip);
  326.  
  327.     print "\n";
  328.     print "Host: $host\nDate: $date\n";
  329.     print "\n";
  330.     print " "*10,"IP Group\n";
  331.  
  332.   print "\n";
  333.   print "Forwarding          ",$ipForwarding2a{$ip{"ipForwarding[0]"}},"\n";
  334.   print "Default TTL         ",$ip{"ipDefaultTTL[0]"}+0,"\n";
  335.   print "Input\n";
  336.   print "  Datagrams         ",$ip{"ipInReceives[0]"}+0,"\n";
  337.   print "  Hardware Err      ",$ip{"ipInHdrErrors[0]"}+0,"\n";
  338.   print "  Address Err       ",$ip{"ipInAddrErrors[0]"}+0,"\n";
  339.   print "  Unknown Proto     ",$ip{"ipInUnknownProtos[0]"}+0,"\n";
  340.   print "  Discards          ",$ip{"ipInDiscards[0]"}+0,"\n";
  341.   print "  Delivers          ",$ip{"ipInDelivers[0]"}+0,"\n";
  342.   print "Output\n";
  343.   print "  Datagrams         ",$ip{"ipOutReceives[0]"}+0,"\n";
  344.   print "  Discards          ",$ip{"ipOutDiscards[0]"}+0,"\n";
  345.   print "  No Routes         ",$ip{"ipOutNoRoutes[0]"}+0,"\n";
  346.   print "Reassembly\n";
  347.   print "  Timeout           ",$ip{"ipReasmTimeout[0]"}+0,"\n";
  348.   print "  Requests          ",$ip{"ipReasmReqds[0]"}+0,"\n";
  349.   print "  OK                ",$ip{"ipReasmOKs[0]"}+0,"\n";
  350.   print "  Fail              ",$ip{"ipReasmFails[0]"}+0,"\n";
  351.   print "Frags\n";
  352.   print "  OK                ",$ip{"ipFragOKs[0]"}+0,"\n";
  353.   print "  Fail              ",$ip{"ipFragFails[0]"}+0,"\n";
  354.   print "  Created           ",$ip{"ipFragCreates[0]"}+0,"\n";
  355.   print "Forwarded Datagrams ",$ip{"ipForwDatagrams[0]"}+0,"\n";
  356.  
  357.   $done=0;
  358.   foreach (keys %ip) {
  359.  
  360.       if (/^ipAdEntAddr\[([^]]*)/) {
  361.     if (!$done) {
  362.     print "\n";
  363.          print " "*20,"IP Interface Address Table\n";
  364.          printf("%s  %-15s %-15s %-15s  %s\n",
  365.          "Interface","IP address","Net Mask","Broadcast","Reasm Max (mib II)");
  366.          $done=1;
  367.     }
  368.          $_ = $1;
  369.          printf("  %2d       %-15s %-15s %-15s  %s\n",
  370.         $ip{"ipAdEntIfIndex[$_]"},
  371.                 $_,
  372.         $ip{"ipAdEntNetMask[$_]"},
  373.         $ip{"ipAdEntBcastAddr[$_]"},
  374.         $ip{"ipAdEntReasmMaxSize[$_]"});
  375.       }
  376.   }
  377.  
  378.   $done=0;
  379.   foreach (keys %ip) {
  380.  
  381.       if (/^ipRouteDest\[([^]]*)/) {
  382.     if (!$done) {
  383.     print "\n";
  384.          print " "*25,"Routing Table\n";
  385.  
  386.          printf("%-15s %7s  %-15s %-7s  %s\n","Destination","Interface","Next Hop","Type","Mask (mib II)");
  387.          $done=1;
  388.     }
  389.          $_ = $1;
  390.          printf("%-15s    %2d      %-15s %-7s  %s\n",
  391.                 $_,
  392.         $ip{"ipRouteIfIndex[$_]"},
  393.         $ip{"ipRouteNextHop[$_]"},
  394.         $ifRouteType2a{$ip{"ipRouteType[$_]"}},
  395.         $ip{"ipRouteMask[$_]"});
  396.       }
  397.   }
  398.  
  399. $done=0;
  400.   foreach (keys %ip) {
  401.       if (/^ipNetToMediaIfIndex\[([^]]*)/) {
  402. if (!$done) {
  403.          print "\n";
  404.          print " "*15,"Net to Media Table (ARP cache)\n";
  405.          printf(" %s   %-17s    %-15s  %s\n",
  406.            "Interface","Physical Address","IP Address","Type");
  407.    $done=1;
  408. }
  409.          $index = $_ = $1;
  410.          ($if,$ip) = /(\d+)\.(.*)/;
  411.          printf("   %2d        %-17s    %-15s  %s\n",
  412.                 $if,
  413.         $ip{"ipNetToMediaPhysAddress[$index]"},
  414.                 $ip,
  415.         $ipNetToMediaType2a{$ip{"ipNetToMediaType[$index]"}});
  416.       }
  417.   }
  418.     print "\n";
  419.  
  420. }
  421.  
  422.  
  423. sub dump_tcp {
  424.  
  425.   local($host) = @_;
  426.   local(*tcp);
  427.  
  428.   &get_table($host,"tcp",*tcp);
  429.  
  430.     print "\n";
  431.     print "Host: $host\nDate: $date\n";
  432.     print "\n";
  433.     print "       TCP Group\n";
  434.     print "\n";
  435. print "Retrans Algorithm    ",$tcpRtoAlgorithm2a{$tcp{"tcpRtoAlgorithm[0]"}},"\n";
  436. print "Retrans Min Timeout  ",$tcp{"tcpRtoMin[0]"},"\n";
  437. print "Retrans Max Timeout  ",$tcp{"tcpRtoMax[0]"},"\n";
  438. print "Max Connections      ",$tcp{"tcpMaxConn[0]"},"\n";
  439. print "Active Opens         ",$tcp{"tcpActiveOpens[0]"},"\n";
  440. print "Passive Opens        ",$tcp{"tcpPassiveOpens[0]"},"\n";
  441. print "Attempt Fails        ",$tcp{"tcpAttemptFails[0]"},"\n";
  442. print "Connection Resets    ",$tcp{"tcpEstabResets[0]"},"\n";
  443. print "Current Connections  ",$tcp{"tcpCurrEstab[0]"},"\n";
  444. print "Input Segments       ",$tcp{"tcpInSegs[0]"},"\n";
  445. print "Output Segments      ",$tcp{"tcpOutSegs[0]"},"\n";
  446. print "Retrans Segments     ",$tcp{"tcpRetransSegs[0]"},"\n";
  447. print "Input Errors         ",$tcp{"tcpInErrs[0]"},"\n";
  448. print "Output Resets        ",$tcp{"tcpOutRsts[0]"},"\n";
  449.  
  450.     print "\n";
  451. print " "*20,"TCP Connection Table\n";
  452. print " "*10,"Local "," "*20,"Remote\n";
  453.          printf("%-15s %5s      %-15s %5s    %s\n",
  454.                "Address","Port","Address","Port","State");
  455.   foreach (keys %tcp) {
  456.  
  457.       if (/^tcpConnState\[([^]]*)/) {
  458.          $_ = $index = $1;
  459.          ($lip,$lp,$rip,$rp) = 
  460.               /(\d+\.\d+\.\d+\.\d+)\.(\d+)\.(\d+\.\d+\.\d+\.\d+)\.(\d+)/;
  461.               $tcpConnState = $tcpConnState2a{$tcp{"tcpConnState[$index]"}};
  462.          printf("%-15s %5d      %-15s %5d    %s\n",
  463.                     $lip,$lp,$rip,$p,$tcpConnState);
  464.       }
  465.   }
  466.     print "\n";
  467. }
  468.  
  469.  
  470. sub dump_udp {
  471.  
  472.   local($host) = @_;
  473.   local(*udp);
  474.  
  475.   &get_table($host,"udp",*udp);
  476.  
  477.     print "\n";
  478.     print "Host: $host\nDate: $date\n";
  479.     print "\n";
  480.     print "       UDP Group\n";
  481.     print "\n";
  482.  
  483.     print "Input Datagrams   ", $udp{"udpInDatagrams[0]"}+0,"\n";
  484.     print "Input Errors      ", $udp{"udpInErrors[0]"}+0,"\n";
  485.     print "Unknown Dest Port ", $udp{"udpNoPorts[0]"}+0,"\n";
  486.     print "Output Datagrams  ", $udp{"udpOutDatagrams[0]"}+0,"\n";
  487.  
  488.   foreach (keys %udp) {
  489.  
  490.       if (/^udpLocalPort\[([^]]*)/) {
  491. if (!$done) {
  492.     print "\n";
  493. print " "*10,"UDP Table\n";
  494.          printf("%-15s %5s\n","Local Address","Local Port");
  495.  $done=1;
  496. }
  497.          $_ = $index = $1;
  498.          ($lip,$lp) =/(\d+\.\d+\.\d+\.\d+)\.(\d+)/;
  499.          printf("%-15s    %5d\n",$lip,$lp);
  500.       }
  501.   }
  502.     print "\n";
  503. }
  504.  
  505.  
  506.  
  507. sub dump_icmp {
  508.  
  509.   local($host) = @_;
  510.   local(*icmp);
  511.  
  512.   &get_table($host,"icmp",*icmp);
  513.  
  514.     print "\n";
  515.     print "Host: $host\nDate: $date\n";
  516.     print "\n";
  517.     print " "*30,"ICMP Group\n";
  518.  
  519.     print "\n";
  520.     printf("                           Input         Output\n");
  521.     printf(" Messages           %12d   %12d\n", $icmp{"icmpInMsgs[0]"}, $icmp{"icmpOutMsgs[0]"});
  522.     printf(" Errors             %12d   %12d\n", $icmp{"icmpInErrors[0]"}, $icmp{"icmpOutErrors[0]"});
  523.     printf(" Dest unreach       %12d   %12d\n", $icmp{"icmpInDestUnreachs[0]"}, $icmp{"icmpOutDestUnreachs[0]"});
  524.     printf(" Time exceeds       %12d   %12d\n", $icmp{"icmpInTimeExcds[0]"}, $icmp{"icmpInTOuteExcds[0]"});
  525.     printf(" Parm problems      %12d   %12d\n", $icmp{"icmpInParmProbs[0]"}, $icmp{"icmpOutParmProbs[0]"});
  526.     printf(" Source Quenchs     %12d   %12d\n", $icmp{"icmpInSrcQuenchs[0]"}, $icmp{"icmpOutSrcQuenchs[0]"});
  527.     printf(" Redirects          %12d   %12d\n", $icmp{"icmpInRedirects[0]"}, $icmp{"icmpInRedOutects[0]"});
  528.     printf(" Echos              %12d   %12d\n", $icmp{"icmpInEchos[0]"}, $icmp{"icmpOutEchos[0]"});
  529.     printf(" Echo reps          %12d   %12d\n", $icmp{"icmpInEchoReps[0]"}, $icmp{"icmpOutEchoReps[0]"});
  530.     printf(" Timestamps         %12d   %12d\n", $icmp{"icmpInTimestamps[0]"}, $icmp{"icmpInTOutestamps[0]"});
  531.     printf(" Timestamp reps     %12d   %12d\n", $icmp{"icmpInTimestampReps[0]"}, $icmp{"icmpInTOutestampReps[0]"});
  532.     printf(" Address masks      %12d   %12d\n", $icmp{"icmpInAddrMasks[0]"}, $icmp{"icmpOutAddrMasks[0]"});
  533.     printf(" Address mask reps  %12d   %12d\n", $icmp{"icmpInAddrMaskReps[0]"}, $icmp{"icmpOutAddrMaskReps[0]"});
  534.  
  535.  
  536.  
  537.     print "\n";
  538. }
  539.  
  540.  
  541. sub get_table { 
  542.     local($host,$t,*table) = @_;
  543.  
  544.  open(SNMP,"echo '$t\[]' | $snmp_table $host|");
  545.  while(<SNMP>) {
  546.     chop;
  547.     /^(.*)=(.*)$/;
  548.     $table{$1} = $2;
  549.  }
  550. }
  551.  
  552.  
  553. 1;
  554.